import {defineConfig} from 'vite';
import {createHtmlPlugin} from 'vite-plugin-html';
import MyCreateHtmlPlugin from './plugins/my-vite-plugin-html';

export default defineConfig(() => {
  
  console.log(createHtmlPlugin()); // [{name: 'vite:html', enforce: 'pre', ...}, {name: 'vite:minify-html', enforce: 'post', ...}]
  console.log(MyCreateHtmlPlugin()); // {name: 'my-vite-plugin-html', transformIndexHtml: {order: 'pre', handler: [Function: handler]}}
  
  return {
    plugins: [
      /* createHtmlPlugin({
        inject: {
          data: {
            title: '插件学习',
            body_content: '插件学习呀'
          }
        }
      }), */
      MyCreateHtmlPlugin({
        inject: {
          data: {
            title: '插件学习',
            body_content: '插件学习呀'
          }
        }
      }),
    ]
  };
});